# TODO integrate NicEdit !!! 
class SheetController < ApplicationController

  def new
    @sheet = Sheet.new( params[:sheet])
    if request.post? and @sheet.save
      flash[:notice] = 'Table successfully created'
      redirect_to :action => 'show', :id => @sheet.id
    end
  end

  def delete
    #@sheet = Sheet.find(params[:id])
    @sheet = Sheet.find(11)
   # @sheet.destroy
    
    respond_to do |wants|
      wants.html { redirect_to :action => 'index' }
      wants.js { render }
    end
  end

  def show
    @sheet = Sheet.find(params[:id])
  end
  
  def index
    @sheets = Sheet.find(:all)
  end
end
